package com.yayan.xh.service;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.yayan.xh.bean.EnterDetailBean;
import com.yayan.xh.dao.EnterDetailDao;
import com.yayan.xh.dao.IEnterDetailDao;

@Service
public class EnterDetailService implements IEnterDetailService {

	private IEnterDetailDao enterDetailDao;
	
	public EnterDetailService() {
		enterDetailDao = new EnterDetailDao();
	}
	
	@Override
	public boolean saveEnterDetailFront(Map<String, String> map) {
		boolean f = false;
		try {
			if(null != map.get("shopId") && null != map.get("matchId")
					&& !"0".equalsIgnoreCase(map.get("shopId")) && !"0".equalsIgnoreCase(map.get("matchId"))) {
				f = enterDetailDao.saveEnterDetailFront(map);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return f;
	}

	@Override
	public boolean delEnterDetail(Map<String, String> map) {
		boolean f = false;
		try {
			if(null != map.get("shopId") && null != map.get("edId")
					&& !"0".equalsIgnoreCase(map.get("shopId")) && !"0".equalsIgnoreCase(map.get("edId")))
				f = enterDetailDao.delEnterDetail(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return f;
	}

	@Override
	public List<EnterDetailBean> getEnterDetailByMatchId(Map<String, String> map) {
		List<EnterDetailBean> result = null;
		try {
			if(null != map.get("shopId") && null != map.get("matchId")
					&& !"0".equalsIgnoreCase(map.get("shopId")) && !"0".equalsIgnoreCase(map.get("matchId")))
				result = enterDetailDao.getEnterDetailByMId(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}

}
